Optimal. Leaf size=174 \[ \frac {5 a^2 x}{16}+\frac {b^2 x}{16}-\frac {a b \cos ^6(c+d x)}{3 d}+\frac {5 a^2 \cos (c+d x) \sin (c+d x)}{16 d}+\frac {b^2 \cos (c+d x) \sin (c+d x)}{16 d}+\frac {5 a^2 \cos ^3(c+d x) \sin (c+d x)}{24 d}+\frac {b^2 \cos ^3(c+d x) \sin (c+d x)}{24 d}+\frac {a^2 \cos ^5(c+d x) \sin (c+d x)}{6 d}-\frac {b^2 \cos ^5(c+d x) \sin (c+d x)}{6 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.12, antiderivative size = 174, normalized size of antiderivative = 1.00, number of steps
used = 12, number of rules used = 6, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.214, Rules used = {3169, 2715, 8,
2645, 30, 2648} \begin {gather*} \frac {a^2 \sin (c+d x) \cos ^5(c+d x)}{6 d}+\frac {5 a^2 \sin (c+d x) \cos ^3(c+d x)}{24 d}+\frac {5 a^2 \sin (c+d x) \cos (c+d x)}{16 d}+\frac {5 a^2 x}{16}-\frac {a b \cos ^6(c+d x)}{3 d}-\frac {b^2 \sin (c+d x) \cos ^5(c+d x)}{6 d}+\frac {b^2 \sin (c+d x) \cos ^3(c+d x)}{24 d}+\frac {b^2 \sin (c+d x) \cos (c+d x)}{16 d}+\frac {b^2 x}{16} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 30
Rule 2645
Rule 2648
Rule 2715
Rule 3169
Rubi steps
\begin {align*} \int \cos ^4(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx &=\int \left (a^2 \cos ^6(c+d x)+2 a b \cos ^5(c+d x) \sin (c+d x)+b^2 \cos ^4(c+d x) \sin ^2(c+d x)\right ) \, dx\\ &=a^2 \int \cos ^6(c+d x) \, dx+(2 a b) \int \cos ^5(c+d x) \sin (c+d x) \, dx+b^2 \int \cos ^4(c+d x) \sin ^2(c+d x) \, dx\\ &=\frac {a^2 \cos ^5(c+d x) \sin (c+d x)}{6 d}-\frac {b^2 \cos ^5(c+d x) \sin (c+d x)}{6 d}+\frac {1}{6} \left (5 a^2\right ) \int \cos ^4(c+d x) \, dx+\frac {1}{6} b^2 \int \cos ^4(c+d x) \, dx-\frac {(2 a b) \text {Subst}\left (\int x^5 \, dx,x,\cos (c+d x)\right )}{d}\\ &=-\frac {a b \cos ^6(c+d x)}{3 d}+\frac {5 a^2 \cos ^3(c+d x) \sin (c+d x)}{24 d}+\frac {b^2 \cos ^3(c+d x) \sin (c+d x)}{24 d}+\frac {a^2 \cos ^5(c+d x) \sin (c+d x)}{6 d}-\frac {b^2 \cos ^5(c+d x) \sin (c+d x)}{6 d}+\frac {1}{8} \left (5 a^2\right ) \int \cos ^2(c+d x) \, dx+\frac {1}{8} b^2 \int \cos ^2(c+d x) \, dx\\ &=-\frac {a b \cos ^6(c+d x)}{3 d}+\frac {5 a^2 \cos (c+d x) \sin (c+d x)}{16 d}+\frac {b^2 \cos (c+d x) \sin (c+d x)}{16 d}+\frac {5 a^2 \cos ^3(c+d x) \sin (c+d x)}{24 d}+\frac {b^2 \cos ^3(c+d x) \sin (c+d x)}{24 d}+\frac {a^2 \cos ^5(c+d x) \sin (c+d x)}{6 d}-\frac {b^2 \cos ^5(c+d x) \sin (c+d x)}{6 d}+\frac {1}{16} \left (5 a^2\right ) \int 1 \, dx+\frac {1}{16} b^2 \int 1 \, dx\\ &=\frac {5 a^2 x}{16}+\frac {b^2 x}{16}-\frac {a b \cos ^6(c+d x)}{3 d}+\frac {5 a^2 \cos (c+d x) \sin (c+d x)}{16 d}+\frac {b^2 \cos (c+d x) \sin (c+d x)}{16 d}+\frac {5 a^2 \cos ^3(c+d x) \sin (c+d x)}{24 d}+\frac {b^2 \cos ^3(c+d x) \sin (c+d x)}{24 d}+\frac {a^2 \cos ^5(c+d x) \sin (c+d x)}{6 d}-\frac {b^2 \cos ^5(c+d x) \sin (c+d x)}{6 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.27, size = 147, normalized size = 0.84 \begin {gather*} \frac {\left (5 a^2+b^2\right ) (c+d x)}{16 d}-\frac {5 a b \cos (2 (c+d x))}{32 d}-\frac {a b \cos (4 (c+d x))}{16 d}-\frac {a b \cos (6 (c+d x))}{96 d}+\frac {\left (15 a^2+b^2\right ) \sin (2 (c+d x))}{64 d}+\frac {\left (3 a^2-b^2\right ) \sin (4 (c+d x))}{64 d}+\frac {\left (a^2-b^2\right ) \sin (6 (c+d x))}{192 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.24, size = 118, normalized size = 0.68
method | result | size |
derivativedivides | \(\frac {b^{2} \left (-\frac {\sin \left (d x +c \right ) \left (\cos ^{5}\left (d x +c \right )\right )}{6}+\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{24}+\frac {d x}{16}+\frac {c}{16}\right )-\frac {a b \left (\cos ^{6}\left (d x +c \right )\right )}{3}+a^{2} \left (\frac {\left (\cos ^{5}\left (d x +c \right )+\frac {5 \left (\cos ^{3}\left (d x +c \right )\right )}{4}+\frac {15 \cos \left (d x +c \right )}{8}\right ) \sin \left (d x +c \right )}{6}+\frac {5 d x}{16}+\frac {5 c}{16}\right )}{d}\) | \(118\) |
default | \(\frac {b^{2} \left (-\frac {\sin \left (d x +c \right ) \left (\cos ^{5}\left (d x +c \right )\right )}{6}+\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{24}+\frac {d x}{16}+\frac {c}{16}\right )-\frac {a b \left (\cos ^{6}\left (d x +c \right )\right )}{3}+a^{2} \left (\frac {\left (\cos ^{5}\left (d x +c \right )+\frac {5 \left (\cos ^{3}\left (d x +c \right )\right )}{4}+\frac {15 \cos \left (d x +c \right )}{8}\right ) \sin \left (d x +c \right )}{6}+\frac {5 d x}{16}+\frac {5 c}{16}\right )}{d}\) | \(118\) |
risch | \(\frac {5 a^{2} x}{16}+\frac {b^{2} x}{16}-\frac {a b \cos \left (6 d x +6 c \right )}{96 d}+\frac {\sin \left (6 d x +6 c \right ) a^{2}}{192 d}-\frac {\sin \left (6 d x +6 c \right ) b^{2}}{192 d}-\frac {a b \cos \left (4 d x +4 c \right )}{16 d}+\frac {3 \sin \left (4 d x +4 c \right ) a^{2}}{64 d}-\frac {\sin \left (4 d x +4 c \right ) b^{2}}{64 d}-\frac {5 a b \cos \left (2 d x +2 c \right )}{32 d}+\frac {15 \sin \left (2 d x +2 c \right ) a^{2}}{64 d}+\frac {\sin \left (2 d x +2 c \right ) b^{2}}{64 d}\) | \(164\) |
norman | \(\frac {\left (\frac {5 a^{2}}{16}+\frac {b^{2}}{16}\right ) x +\left (\frac {5 a^{2}}{16}+\frac {b^{2}}{16}\right ) x \left (\tan ^{12}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {15 a^{2}}{8}+\frac {3 b^{2}}{8}\right ) x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {15 a^{2}}{8}+\frac {3 b^{2}}{8}\right ) x \left (\tan ^{10}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {25 a^{2}}{4}+\frac {5 b^{2}}{4}\right ) x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {75 a^{2}}{16}+\frac {15 b^{2}}{16}\right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {75 a^{2}}{16}+\frac {15 b^{2}}{16}\right ) x \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\frac {\left (5 a^{2}-47 b^{2}\right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{24 d}+\frac {\left (5 a^{2}-47 b^{2}\right ) \left (\tan ^{9}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{24 d}+\frac {\left (11 a^{2}-b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{8 d}-\frac {\left (11 a^{2}-b^{2}\right ) \left (\tan ^{11}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{8 d}+\frac {\left (15 a^{2}-13 b^{2}\right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 d}-\frac {\left (15 a^{2}-13 b^{2}\right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 d}+\frac {4 a b \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {40 a b \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}+\frac {4 a b \left (\tan ^{10}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{6}}\) | \(389\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.29, size = 102, normalized size = 0.59 \begin {gather*} -\frac {64 \, a b \cos \left (d x + c\right )^{6} + {\left (4 \, \sin \left (2 \, d x + 2 \, c\right )^{3} - 60 \, d x - 60 \, c - 9 \, \sin \left (4 \, d x + 4 \, c\right ) - 48 \, \sin \left (2 \, d x + 2 \, c\right )\right )} a^{2} - {\left (4 \, \sin \left (2 \, d x + 2 \, c\right )^{3} + 12 \, d x + 12 \, c - 3 \, \sin \left (4 \, d x + 4 \, c\right )\right )} b^{2}}{192 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 2.44, size = 95, normalized size = 0.55 \begin {gather*} -\frac {16 \, a b \cos \left (d x + c\right )^{6} - 3 \, {\left (5 \, a^{2} + b^{2}\right )} d x - {\left (8 \, {\left (a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{5} + 2 \, {\left (5 \, a^{2} + b^{2}\right )} \cos \left (d x + c\right )^{3} + 3 \, {\left (5 \, a^{2} + b^{2}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{48 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 340 vs.
\(2 (162) = 324\).
time = 0.45, size = 340, normalized size = 1.95 \begin {gather*} \begin {cases} \frac {5 a^{2} x \sin ^{6}{\left (c + d x \right )}}{16} + \frac {15 a^{2} x \sin ^{4}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{16} + \frac {15 a^{2} x \sin ^{2}{\left (c + d x \right )} \cos ^{4}{\left (c + d x \right )}}{16} + \frac {5 a^{2} x \cos ^{6}{\left (c + d x \right )}}{16} + \frac {5 a^{2} \sin ^{5}{\left (c + d x \right )} \cos {\left (c + d x \right )}}{16 d} + \frac {5 a^{2} \sin ^{3}{\left (c + d x \right )} \cos ^{3}{\left (c + d x \right )}}{6 d} + \frac {11 a^{2} \sin {\left (c + d x \right )} \cos ^{5}{\left (c + d x \right )}}{16 d} - \frac {a b \cos ^{6}{\left (c + d x \right )}}{3 d} + \frac {b^{2} x \sin ^{6}{\left (c + d x \right )}}{16} + \frac {3 b^{2} x \sin ^{4}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{16} + \frac {3 b^{2} x \sin ^{2}{\left (c + d x \right )} \cos ^{4}{\left (c + d x \right )}}{16} + \frac {b^{2} x \cos ^{6}{\left (c + d x \right )}}{16} + \frac {b^{2} \sin ^{5}{\left (c + d x \right )} \cos {\left (c + d x \right )}}{16 d} + \frac {b^{2} \sin ^{3}{\left (c + d x \right )} \cos ^{3}{\left (c + d x \right )}}{6 d} - \frac {b^{2} \sin {\left (c + d x \right )} \cos ^{5}{\left (c + d x \right )}}{16 d} & \text {for}\: d \neq 0 \\x \left (a \cos {\left (c \right )} + b \sin {\left (c \right )}\right )^{2} \cos ^{4}{\left (c \right )} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.46, size = 132, normalized size = 0.76 \begin {gather*} \frac {1}{16} \, {\left (5 \, a^{2} + b^{2}\right )} x - \frac {a b \cos \left (6 \, d x + 6 \, c\right )}{96 \, d} - \frac {a b \cos \left (4 \, d x + 4 \, c\right )}{16 \, d} - \frac {5 \, a b \cos \left (2 \, d x + 2 \, c\right )}{32 \, d} + \frac {{\left (a^{2} - b^{2}\right )} \sin \left (6 \, d x + 6 \, c\right )}{192 \, d} + \frac {{\left (3 \, a^{2} - b^{2}\right )} \sin \left (4 \, d x + 4 \, c\right )}{64 \, d} + \frac {{\left (15 \, a^{2} + b^{2}\right )} \sin \left (2 \, d x + 2 \, c\right )}{64 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.61, size = 156, normalized size = 0.90 \begin {gather*} \frac {5\,a^2\,x}{16}+\frac {b^2\,x}{16}+\frac {5\,a^2\,{\cos \left (c+d\,x\right )}^3\,\sin \left (c+d\,x\right )}{24\,d}+\frac {a^2\,{\cos \left (c+d\,x\right )}^5\,\sin \left (c+d\,x\right )}{6\,d}+\frac {b^2\,{\cos \left (c+d\,x\right )}^3\,\sin \left (c+d\,x\right )}{24\,d}-\frac {b^2\,{\cos \left (c+d\,x\right )}^5\,\sin \left (c+d\,x\right )}{6\,d}-\frac {a\,b\,{\cos \left (c+d\,x\right )}^6}{3\,d}+\frac {5\,a^2\,\cos \left (c+d\,x\right )\,\sin \left (c+d\,x\right )}{16\,d}+\frac {b^2\,\cos \left (c+d\,x\right )\,\sin \left (c+d\,x\right )}{16\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________